import request from '@/utils/request'

// 查询地区列表
export function listArea(query) {
  return request({
    url: '/iot/area/list',
    method: 'get',
    params: query
  })
}

// 查询地区详细
export function getArea(id) {
  return request({
    url: '/iot/area/' + id,
    method: 'get'
  })
}
// 获取子地区列表（用于三级联动）
export function getSubAreas(query) {
  return request({
    url: '/iot/area/subareas',
    method: 'get',
    params: query
  })
}
export function listProvinces() {
  return request({
    url: '/iot/area/provinces',
    method: 'get'
  })
}

export function listCities(provinceId) {
  return request({
    url: '/iot/area/cities',
    method: 'get',
    params: { provinceId }
  })
}

export function listDistricts(cityId) {
  return request({
    url: '/iot/area/districts',
    method: 'get',
    params: { cityId }
  })
}
